<template>
	<view class="category-orders">
		<view class="con-1">
			<nav-bar title="报赛中心" :color="navBarColor" :bg="navBarBg"></nav-bar>
			<view class="bg">
				<view class="address">
					<view class="flex-space-between">
						<view class="flex-align" >
							<!-- <van-image v-if="itemChooselist.venue_thumb != ''" width="74rpx" height="74rpx" radius="2" 
								style="margin-right: 10rpx;" :src="itemChooselist.venue_thumb" /> -->
							<image v-if="itemChooselist.venue_thumb != ''"
								style="margin-right: 10rpx;position: unset;width: 74rpx;height: 74rpx;border-radius: 2rpx;"
								:src="itemChooselist.venue_thumb"></image>
							<van-image v-else width="74rpx" height="74rpx" radius="10rpx" fit="cover" style="margin-right: 10rpx;" src="https://img.yzcdn.cn/vant/cat.jpeg" />
							<view>
								<view class="address-name">{{itemChooselist.venue_name}}</view>
								<view class="address-desc">地址:{{itemChooselist.address}}</view>
							</view>
						</view>
						<view class="exchange flex-center flex-column " @click="show_no">
							<van-icon name="exchange" size="16" />
							切换
						</view>
					</view>
				</view>
			</view>

		</view>
		<van-row class="dates text-center">
			<van-col v-for="item in dates" :key="item.value" :span="6">
				<view class="date-item" :class="{ active: dateActive === item.value }" @click="dataslist(item)">
					{{ item.label }}
				</view>
			</van-col>
		</van-row>

		<view style="width: 100%; height: 60rpx;background-color: #f8f8f8;margin-top: 20rpx;">
			<view style="float: left;">
				<image style="width: 32rpx;height: 32rpx;margin-top: 15rpx;margin-left: 30rpx;"
					src="https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/dbe7a7371520f7585b4a83558336c24acbace2cc.png"
					mode=""></image>
			</view>
			<view style="float: left;line-height: 60rpx;font-size: 28rpx;color: #aaaaaa;margin-left: 20rpx;">
				数据仅供参考，以后台财务数据为准
			</view>
		</view>
		
		<van-row class="dates text-center">
			<van-col v-for="item in datelist" :key="item.value" :span="12"  >
				<view class="date-item" :class="{ active: jxzActive === item.value }" @click="jxzlist(item)">
					{{ item.label }}
				</view>
			</van-col>
		</van-row>

		<view class="flex-col list space-y-30">
			<view class="flex-col list-item" :key="i" v-for="(item, i) in 12" @click="teaching_detailed(item)">
				<view class="flex-row justify-between items-center">
					<view class="flex-row items-center space-x-21">
						<image class="shrink-0 image_6"
							src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61af0460d092020011e18206/16784287074060340013.png" />
						<text class="font_3">衡阳奥星</text>
					</view>
					<image class="image_7"
						src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/61af0460d092020011e18206/16784287074010216421.png" />
				</view>
				<view class="flex-row equal-division">
					<view class="flex-col items-center equal-division-item group_3 space-y-30">
						<text class="font_4">900</text>
						<text class="font_1 text_7">放场量</text>
					</view>
					<view class="flex-col items-center equal-division-item group_4 space-y-30">
						<text class="font_4">300</text>
						<text class="font_1 text_8">预订量</text>
					</view>
					<view class="flex-col items-center equal-division-item group_5 space-y-30">
						<text class="font_4">30%</text>
						<text class="font_1 text_9">预订率</text>
					</view>
				</view>
				
			</view>
		</view>
		
		<van-popup closeable :show="show" round position="bottom" @close="showclose">
			<view class="good-box">
				<view class="title">
					切换场馆
				</view>
				<view class="good-list">
					<!-- <van-radio-group :value="radio" @change="onChange"> -->
					<view class="good-item" v-for="(item,index) in venuelist" :key="index" @click="onChangelist(item)">
						<!-- <van-radio :name="index" :value="index" color="#2f75fa"
								:checked="index == 0 ? true : false"> -->
						<view class="flex-align">
							<van-image width="124rpx" height="124rpx" radius="10rpx" fit="cover"
								v-if="item.venue_thumb != ''" :src="item.venue_thumb" />
							<van-image v-else width="124rpx" height="124rpx" radius="10rpx" fit="cover"
								src="https://img.yzcdn.cn/vant/cat.jpeg" />
							<view class="info">
								<view class="name">{{item.venue_name}}</view>
								<view class="flex-align" v-if="item.project_list != ''">
									<view class="tag" v-if="item.project_list[0].name != ''">
										{{item.project_list[0].name}}
									</view>
									<view class="tag" v-if="item.project_list[1].name != ''">
										{{item.project_list[1].name}}
									</view>
									<view class="tag" v-if="item.project_list[2].name != ''">
										{{item.project_list[2].name}}
									</view>
								</view>
								<view class="address">{{item.address}}</view>
							</view>
						</view>
						<!-- </van-radio> -->
					</view>
					<!-- </van-radio-group> -->
				</view>

				<!-- <view class="footer">
					<view class="btn" @click="queren">确认</view>
				</view> -->
			</view>
		</van-popup>
	</view>
</template>

<script>
	const personal = require("@/api/personal/index.js");
	import navbar from '@/mixins/navbar.js';
	export default {
		mixins: [navbar({
			navBarColor: '#fff'
		})],
		data() {
			return {
				tableData: [],
				dates: [{
						label: '今日',
						value: '5'
					},
					{
						label: '本周',
						value: '6'
					},
					{
						label: '本月',
						value: '7'
					},
					{
						label: '本年',
						value: '8'
					},
				],
				datelist: [{
						label: '进行中',
						value: '1'
					},
					{
						label: '已结束',
						value: '6'
					}
				],
				dateActive: '5',
				jxzActive: '1',
				show: false,
				venuelist: [], //场馆列表
				itemChooselist: {}, // 场馆数据
				itemChoose: {},
				showlist: true,
				nac: '5',
				jxznac: '1',
				after_sale_num: '',
				complete_num: '',
				total_num: '',
			}
		},
		onLoad() {
			if (uni.getStorageSync("entry_name") == '') {
				uni.showToast({
					title: '请登录！',
					icon: 'exception',
					duration: 850
				});
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/my-center/my-center'
					})
				}, 1000);
			}
			var data = uni.getStorageSync("wqzdy");
			var items = JSON.parse(data)
			this.venuelist = items
			this.itemChooselist = this.venuelist[0]
			this.stat_order()
		},
		methods: {
			jxzlist(item){
				this.jxzActive = item.value
			},
			dataslist(item) {
				this.dateActive = item.value
				this.nac = item.value
			},
			teaching_detailed(item){
				uni.navigateTo({
					url:'./registration_detailed'
				})
			},
			// 订单类型分析
			async stat_order() {
				// uni.showLoading({
				// 	title: "加载中",
				// 	mask: true,
				// });
				let params = {
					venue_id: this.itemChooselist.id,
					sourceTab: this.nac
				};
				let res = await personal.stat_order(params);
				if (res.code == 1) {
				}
			},
			
			onChange({
				detail: {
					index
				}
			}) {
				this.tabActive = index;
			},
			// 选择场馆
			onChange(e) {
				let that = this
				let i = e.detail
				const item = this.venuelist[i]
				if (item) {
					this.itemChoose = item
					this.venuelist[i].checked = true
				} else {
					this.itemChoose = {}
				}
			},
			onChangelist(item) {
				this.itemChoose = item
				this.itemChooselist = this.itemChoose
				this.show = false
				this.showlist = true
				this.dateActive = '5'
				this.nac = '5'
			},
			// 确认按钮
			queren() {
				this.itemChooselist = this.itemChoose
				this.show = false
				this.showlist = true
				this.dateActive = '5'
				this.nac = '5'
			},
			show_no() {
				this.show = true
				this.showlist = false
			},
			showclose() {
				this.show = false
				this.showlist = true
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '../../static/css/common/common.scss';

	.category-orders {
		// padding-bottom: 40rpx;
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		background-color: rgb(243, 243, 243);

		.con-1 {
			width: 100%;
			position: relative;

			/deep/ .nav-bar {
				position: fixed;
			}

			.bg {
				width: 100%;
				height: 300rpx;
				background-image: url("https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/5d1ccc3b7ac6cc185130c88a8ac2e90b1eeba707.png");
				background-size: 100%;
				background-position: 50% 80%;

				.address {
					color: #fff;
					padding-top: 190rpx;
					padding-right: 30rpx;
					padding-left: 30rpx;
					height: 150rpx;

					&-name {
						font-size: 34rpx;
						font-weight: 700;
						line-height: 34rpx;
					}

					&-desc {
						margin-top: 18rpx;
						font-size: 22rpx;
						line-height: 22rpx;
					}

					.exchange {
						width: 100rpx;
						height: 100rpx;
						border-radius: 50%;
						background-color: rgba(0, 0, 0, 0.2);
						color: rgb(234, 248, 248);
						font-size: 24rpx;
					}
				}
			}
		}

		.dates {
			color: rgb(136, 136, 136);
			font-size: 28rpx;

			.date-item {
				padding: 30rpx 0;
			}

			.active {
				color: rgb(51, 51, 51);
				font-weight: 700;
			}
		}

		.con-3 {
			width: 100%;
			height: 80rpx;
			background-color: #f8f8f8;
			color: rgb(51, 51, 51);
			font-size: 28rpx;
			font-weight: 700;

			.con-3_left {
				float: left;
				line-height: 80rpx;
				margin-left: 29rpx;
			}

			.con-3_right {
				float: right;
				line-height: 80rpx;
				color: rgb(90, 101, 255);
				margin-right: 29rpx;
			}
		}

		/deep/ .good-box {
			height: 60vh;
			padding: 0px 30rpx;
			display: flex;
			flex-direction: column;

			.title {
				color: #000;
				font-size: 30rpx;
				font-weight: 700;
				margin-top: 40rpx;
			}

			.van-radio__label {
				line-height: inherit;
			}

			.good-list {
				flex: 1;
				height: 0;
				overflow: auto;

				.good-item {
					margin-top: 30rpx;

					.info {
						margin-left: 25rpx;

						.address {
							color: #fff;
							padding-top: 20rpx;
							padding-right: 30rpx;
							height: 70rpx;

							&-name {
								font-size: 34rpx;
								font-weight: 700;
								line-height: 34rpx;
							}

							&-desc {
								margin-top: 18rpx;
								font-size: 22rpx;
								line-height: 22rpx;
							}

							.exchange {
								width: 100rpx;
								height: 100rpx;
								border-radius: 50%;
								background-color: rgba(0, 0, 0, 0.2);
								color: rgb(234, 248, 248);
								font-size: 24rpx;
							}
						}

						.name {
							color: rgb(51, 51, 51);
							font-size: 30rpx;
							font-weight: 500;
							margin-bottom: 10rpx;
						}


						.tag {
							color: rgb(4, 179, 90);
							font-size: 24rpx;
							font-weight: 500;
							padding: 0px 10rpx;
							margin-right: 20rpx;
							background-color: rgba(4, 179, 90, 0.2);
							border-radius: 4rpx;

							&:nth-of-type(2) {
								color: rgb(236, 70, 246);
								background-color: rgba(236, 70, 246, 0.2);
							}
						}

						.address {
							margin-top: 10rpx;
							color: rgb(136, 136, 136);
							font-size: 22rpx;
						}
					}

				}
			}

			.footer {
				padding: 20rpx 0;
				background-color: rgb(255, 255, 255);

				.btn {
					color: rgb(255, 255, 255);
					font-size: 30rpx;
					font-weight: 700;
					padding: 20rpx 0;
					text-align: center;
					background-image: linear-gradient(0deg, rgb(99, 93, 247) 0%, rgb(165, 173, 246) 100%);
					border-radius: 60rpx;
				}
			}
		}

		/deep/.van-dropdown-menu {
			box-shadow: none;
			height: 80rpx;
		}

		.title {
			font-size: 30rpx;
			font-weight: 700;
			line-height: 29rpx;
			padding: 30rpx;
		}

		.list {
			margin-top: 29rpx;
			padding: 0 20rpx;

			.list-item {
				padding: 30rpx 20rpx;
				background-color: #ffffff;
				box-shadow: 0px 13rpx 57rpx #0849a214;
				background-image: linear-gradient(0deg, #ffffff 0%, #eee7fd 100%);
				border-radius: 16rpx;

				.space-x-21 {

					&>view:not(:first-child),
					&>text:not(:first-child),
					&>image:not(:first-child) {
						margin-left: 21rpx;
					}

					.image_6 {
						width: 40rpx;
						height: 40rpx;
					}

					.font_3 {
						font-size: 28rpx;
						font-family: PingFang SC;
						line-height: 27rpx;
						font-weight: 500;
						color: #333333;
					}
				}

				.image_7 {
					width: 13rpx;
					height: 22rpx;
				}

				.equal-division {
					margin: 19rpx 36rpx 0;

					.group_3 {
						flex: 1 1 200rpx;
					}

					.group_4 {
						flex: 1 1 200rpx;
					}

					.group_5 {
						flex: 1 1 200rpx;
					}
				}

				.equal-division_3 {
					margin: 19rpx 30rpx 0 28rpx;

					.group_8 {
						flex: 1 1 204.5rpx;
					}

					.group_9 {
						flex: 1 1 204.5rpx;
					}

					.group_10 {
						flex: 1 1 204.5rpx;
					}
				}

				.equal-division-item {
					padding: 10rpx 0;

					.font_4 {
						font-size: 48rpx;
						font-family: DIN;
						line-height: 36rpx;
						font-weight: 700;
						color: #333333;
					}

					.text_7 {
						font-size: 23rpx;
					}

					.text_8 {
						font-size: 23rpx;
					}

					.text_9 {
						font-size: 23rpx;
					}

					.text_12 {
						font-size: 23rpx;
					}

					.text_13 {
						font-size: 23rpx;
					}

					.text_14 {
						font-size: 23rpx;
					}
				}

				.group_11 {
					margin-top: 19rpx;

					.equal-division_4 {
						width: 408rpx;

						.pos_5 {
							position: absolute;
							left: 28rpx;
							top: 0;

							.text_15 {
								margin-left: 22rpx;
								line-height: 22rpx;
							}

							.image_10 {
								margin-left: 17rpx;
							}
						}

						.text_16 {
							margin-left: 34rpx;
							line-height: 22rpx;
						}

						.group_12 {
							margin-left: 15rpx;
						}
					}

					.section_5 {
						background-color: #cd5688;
						border-radius: 7.5rpx;
						width: 20rpx;
						height: 21rpx;
					}

					.pos_6 {
						position: absolute;
						left: 0;
						top: 3rpx;
					}
				}

				.font_7 {
					font-size: 24rpx;
					font-family: PingFang SC;
					line-height: 23rpx;
					font-weight: 500;
					color: #333333;
				}

				.image_8 {
					width: 10rpx;
					height: 21rpx;
				}

				.font_5 {
					font-size: 31rpx;
					font-family: Adobe Heiti Std;
					line-height: 25rpx;
					color: #20bb6c;
				}

				.space-x-5 {

					&>view:not(:first-child),
					&>text:not(:first-child),
					&>image:not(:first-child) {
						margin-left: 5rpx;
					}
				}

				.image_9 {
					width: 10rpx;
					height: 20rpx;
				}

				.font_6 {
					font-size: 31rpx;
					font-family: Adobe Heiti Std;
					line-height: 25rpx;
					color: #ff480f;
				}
			}
		}

		.space-y-30 {

			&>view:not(:first-child),
			&>text:not(:first-child),
			&>image:not(:first-child) {
				margin-top: 30rpx;
			}
		}

		.font_1 {
			font-size: 24rpx;
			font-family: PingFang SC;
			line-height: 23rpx;
			font-weight: 500;
			color: #999999;
		}

	}
</style>
